'use client'
import {Switch} from "@nextui-org/react";
import { useTheme } from "next-themes";
import { SunIcon } from "@/public/SunIcon";
import { MoonIcon } from "@/public/MoonIcon";

export default function Nightify(){
    const { theme, setTheme } = useTheme()
    return (
    <Switch
        defaultSelected
        size="lg"
        color="success"
        isSelected={theme == 'light'}
        thumbIcon={({ isSelected, className }) =>
            isSelected ? (
            <SunIcon className={className} />
            ) : (
            <MoonIcon className={className} />
            )
      }
      onChange={() => {setTheme(theme === "dark" ? "light" : "dark")}}
    >
    </Switch>
    )
}